import { get, post, put, del } from '../../utils/request';

/**
 * 获取设备列表
 * @param params 查询参数
 * @returns Promise
 */
export const getDeviceList = (params?: any) => {
  return get('device/getList', params);
};

/**
 * 获取设备详情
 * @param id 设备ID
 * @returns Promise
 */
export const getDeviceDetail = (id: string) => {
  return get(`device/detail/${id}`);
};

/**
 * 添加设备
 * @param data 设备信息
 * @returns Promise
 */
export const addDevice = (data: any) => {
  return post('device/add', data);
};

/**
 * 更新设备
 * @param id 设备ID
 * @param data 设备信息
 * @returns Promise
 */
export const updateDevice = (id: string, data: any) => {
  return put(`device/update/${id}`, data);
};

/**
 * 删除设备
 * @param id 设备ID
 * @returns Promise
 */
export const deleteDevice = (id: string) => {
  return del(`device/delete/${id}`);
};

/**
 * 获取设备状态
 * @param id 设备ID
 * @returns Promise
 */
export const getDeviceStatus = (id: string) => {
  return get(`device/status/${id}`);
};

/**
 * 批量操作设备
 * @param action 操作类型
 * @param ids 设备ID数组
 * @returns Promise
 */
export const batchOperateDevices = (action: string, ids: string[]) => {
  return post('device/batchOperate', { action, ids });
};
